package com.example.tool.screenmatch;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * Created Date 2019/5/29
 *
 * @author liangkun
 * description：
 */
public class SpUtil {
    public static void main(String[] args) {
//        //432
//        for (int i = 6; i < 49; i++) {
//            double d = divide(432d, 360d, 2) * i;
//            System.out.println(d+" i "+i);
//
//        }
        System.out.println("*******************************************************");
        //512
        for (int i = 6; i < 49; i++) {
            double d = divide(512d, 360d, 2) * i;
            System.out.println(d+"sp "+i);

        }
        System.out.println("*******************************************************");
        //450
        for (int i = 6; i < 49; i++) {
            double d = divide(450d, 360d, 2) * i;
            System.out.println(d+"sp "+i);

        }
        System.out.println("*******************************************************");

    }

    public static Double divide(Double dividend, Double divisor, Integer scale) {
//        if (dividend == DEF_DIV_DIVISOR_ZERO) {
////            return divisor;
////        }
        BigDecimal b1 = new BigDecimal(Double.toString(dividend));
        BigDecimal b2 = new BigDecimal(Double.toString(divisor));
        return b1.divide(b2, scale, RoundingMode.HALF_UP).doubleValue();
    }
}
